package sm

type Null struct {}

type State int
type States map[State]Null

func (s States) With( x State ) States {
  result := make(States)
  for k, _ := range s { result[k] = Null{} }
  result[x] = Null{}
  return result
}

func (s States) Contains( a State ) bool {
  _, present := s[a]
  return present
}

func (s States) Add( a State ) States {
  s[a] = Null{}
  return s
}

func (s States) AddAll( other States ) States {
  for item, _ := range other { s[item] = Null{} }
  return s 
}

func (s States) IsEmpty() bool {
  return len(s) == 0
}
